package modelo;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import entities.FacturaEntity;
import entities.OrdenCompraEntity;
import hbt.AbstractHibernateManager;

public class OrdenesCompraDao extends AbstractHibernateManager {

			public void save (OrdenCompraEntity fact){
				Session s = null;
				try {
					s=getNewSession();
					s.beginTransaction();
					s.persist(fact);
					s.flush();
					s.getTransaction().commit();
					System.out.println("[OrdenesCompra PERSISTED ON TABLE OrdenesCompra y ItemsOrdenes]::OK");
				} catch (HibernateException e) {
					e.printStackTrace();
				} finally{
					closeSession(s);
				}
			}
			
			
			public void guardar (OrdenCompraEntity fact){
				Session s = null;
				try {
					s=getNewSession();
					s.beginTransaction();
					s.save(fact);
					s.flush();
					s.getTransaction().commit();
					System.out.println("[OrdenesCompra SAVED ON TABLE OrdenesCompra y ItemsOrdenes]::OK");
				} catch (HibernateException e) {
					e.printStackTrace();
				} finally{
					closeSession(s);
				}
			}
			
}
